package com.nhim.cms.admin.server.locator;

import com.google.web.bindery.requestfactory.shared.Locator;
import com.nhim.cms.dao.ContentTypeElementDefinitionDAO;
import com.nhim.cms.dao.IContentTypeElementDefinitionDAO;
import com.nhim.cms.domain.ContentTypeElementDefinition;
import com.nhim.core.AppContext;


public class ContentTypeElementDefinitionLocator  extends Locator<ContentTypeElementDefinition, Integer>{
	IContentTypeElementDefinitionDAO ctypeDAO = ContentTypeElementDefinitionDAO.getFromApplicationContext(AppContext.getApplicationContext());
	@Override
	public ContentTypeElementDefinition create(
			Class<? extends ContentTypeElementDefinition> arg0) {
		return new ContentTypeElementDefinition();
	}

	@Override
	public ContentTypeElementDefinition find(
			Class<? extends ContentTypeElementDefinition> domain, Integer id) {
		if(id ==null)
			return new ContentTypeElementDefinition();
		return ctypeDAO.findById(id);
	}

	@Override
	public Class<ContentTypeElementDefinition> getDomainType() {
		return ContentTypeElementDefinition.class;
	}

	@Override
	public Integer getId(ContentTypeElementDefinition domain) {
		return domain.getId();
	}

	@Override
	public Class<Integer> getIdType() {
		return Integer.class;
	}

	@Override
	public Object getVersion(ContentTypeElementDefinition domain) {
		return domain.getVersion();
	}

}
